package top.braycep.ui;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import top.braycep.bean.JarFile;
import top.braycep.db.DbUtils;
import top.braycep.exception.BaseException;
import top.braycep.file.JarUtils;
import top.braycep.log.LogUtils;

import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.table.*;
/*
 * Created by JFormDesigner on Mon Jan 11 14:27:30 CST 2021
 */


/**
 * @author 123
 */
@Getter
public class MainUI extends JFrame {
    private final JPopupMenu filesPopupMenu = new JPopupMenu();
    private final JPopupMenu jarfilesPopupMenu = new JPopupMenu();
    private final JPopupMenu taskPopupMenu = new JPopupMenu();
    private final JPopupMenu taskDetailPopupMenu = new JPopupMenu();
    private final JPopupMenu settingPopupMenu = new JPopupMenu();


    public MainUI() {
        setResizable(false);

        initComponents();
		LogUtils.setTextPane(logPane1);

		initPopupMenus();

		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

		loadDefaultData();

    }

    private void loadDefaultData() {
        txtFileName.setText("");
        UIUtils.loadData(this, null);
    }

    private void initPopupMenus() {
        JMenuItem item = new JMenuItem("\u6DFB\u52A0\u884C");
        item.addActionListener(l -> addLine(l, tblFiles));
        filesPopupMenu.add(item);
        item = new JMenuItem("\u5220\u9664\u884C");
        item.setForeground(Color.red);
        item.addActionListener(l -> delLine(l, tblFiles));
        filesPopupMenu.add(item);
        filesPopupMenu.addSeparator();
        item = new JMenuItem("\u65B0\u5EFA");
        item.addActionListener(this::newConfig);
        filesPopupMenu.add(item);
        item = new JMenuItem("\u4FDD\u5B58");
        item.addActionListener(this::save);
        filesPopupMenu.add(item);
        filesPopupMenu.addSeparator();
        item = new JMenuItem("\u751F\u6210");
        item.addActionListener(l -> createJar(l, tblFiles));
        filesPopupMenu.add(item);

        // jarfiles table
        item = new JMenuItem("\u751F\u6210");
        item.addActionListener(l -> createJar(l, tblJars));
        jarfilesPopupMenu.add(item);
        item = new JMenuItem("\u52A0\u8F7D");
        jarfilesPopupMenu.add(item);
        item.addActionListener(this::loadConfig);
        item = new JMenuItem("\u9ED8\u8BA4");
        item.addActionListener(this::setDefaultConfig);
        jarfilesPopupMenu.add(item);
        jarfilesPopupMenu.addSeparator();
        item = new JMenuItem("\u5220\u9664");
        item.setForeground(Color.red);
        item.addActionListener(this::delConfigs);
        jarfilesPopupMenu.add(item);

        // tasks
        item = new JMenuItem("\u6DFB\u52A0\u884C");
        item.addActionListener(l -> addLine(l, tblTask));
        taskPopupMenu.add(item);
        item = new JMenuItem("\u5220\u9664\u884C");
        item.addActionListener(l -> delLine(l, tblTask));
        item.setForeground(Color.red);
        taskPopupMenu.add(item);
        item = new JMenuItem("\u6267\u884C");
        item.addActionListener(l -> executeTask(l, tblTask));
        taskPopupMenu.add(item);
        item = new JMenuItem("\u4FDD\u5B58");
        item.addActionListener(l -> executeTask(l, tblTask));
        taskPopupMenu.add(item);

        // tasks details
        item = new JMenuItem("\u65B0\u589E\u884C");
        item.addActionListener(l -> addLine(l, tblTaskDetail));
        taskDetailPopupMenu.add(item);
        item = new JMenuItem("\u590D\u5236\u65B0\u589E");
        item.addActionListener(l -> addLine(l, tblTaskDetail));
        taskDetailPopupMenu.add(item);
        item = new JMenuItem("\u5220\u9664\u884C");
        item.addActionListener(l -> delLine(l, tblTaskDetail));
        item.setForeground(Color.red);
        taskDetailPopupMenu.add(item);
        item = new JMenuItem("\u6267\u884C");
        item.addActionListener(l -> executeTask(l, tblTaskDetail));
        taskDetailPopupMenu.add(item);
        item = new JMenuItem("\u4FDD\u5B58");
        item.addActionListener(l -> executeTask(l, tblTaskDetail));
        taskDetailPopupMenu.add(item);

        // settings
        item = new JMenuItem("\u4FDD\u5B58\u9009\u4E2D");
        item.addActionListener(l -> UIUtils.updateSetting(MainUI.this, tblSettings));
        settingPopupMenu.add(item);
        item = new JMenuItem("\u91CD\u65B0\u52A0\u8F7D");
        item.addActionListener(l -> UIUtils.loadSettings(MainUI.this));
        settingPopupMenu.add(item);
    }

    private void executeTask(ActionEvent l, JTable table) {

    }

    private void loadConfig(ActionEvent e) {
        try {
            List<Long> ids = getSelectedJarIds();
            UIUtils.loadConfig(this, DbUtils.findConfigById(ids.size() > 0 ? ids.get(0) : null));
            UIUtils.showInfo(this, "\u52A0\u8F7D\u6210\u529F");
        } catch (BaseException | NumberFormatException baseException) {
            UIUtils.showInfo(this, baseException.getLocalizedMessage());
        }
    }

    private void delConfigs(ActionEvent e) {
        try {
            List<Long> jarIds = getSelectedJarIds();
            DbUtils.delConfigs(jarIds);
            UIUtils.refreshJarTable(this, DbUtils.findAllConfig());
            UIUtils.showInfo(this, "\u5220\u9664\u6210\u529F");
        } catch (BaseException | NumberFormatException baseException) {
            UIUtils.showInfo(this, baseException.getLocalizedMessage());
        }
    }

    private List<Long> getSelectedJarIds() {
        DefaultTableModel model = (DefaultTableModel) tblJars.getModel();
        int[] selectedRows = tblJars.getSelectedRows();
        List<Long> list = new ArrayList<>();
        for (int selectedRow : selectedRows) {
            Vector vector = (Vector) model.getDataVector().get(selectedRow);
            if (vector != null && vector.get(0) != null) {
                list.add(Long.parseLong(vector.get(0).toString()));
            }
        }
        return list;
    }


    private void setDefaultConfig(ActionEvent e) {
        List<Long> ids = getSelectedJarIds();
        DbUtils.setDefaultConfig(ids.size() > 0 ? ids.get(0) : null);

        UIUtils.refreshJarTable(this, DbUtils.findAllConfig());
    }

    private void newConfig(ActionEvent l) {
        txtId.setText(null);
        txtFileName.setText("");
        txtFilePath.setText("");
        UIUtils.clearTable(tblFiles);
    }

    private void createJar(ActionEvent l, JTable table) {
        try {
        	boolean isOverride = DbUtils.isDeleteOldJar();

            if (table.equals(tblFiles)) {
                UIUtils.checkNameAndPath(txtFileName, txtFilePath);

                JarFile jarFile = UIUtils.buildJarFile(StrUtil.isEmpty(txtId.getText()) ? null : Long.parseLong(txtId.getText()), txtFileName.getText(), txtFilePath.getText(), (DefaultTableModel) tblFiles.getModel());
                JarUtils.createJarFile(jarFile, isOverride);
            } else if (table.equals(tblJars)) {
                DefaultTableModel model = (DefaultTableModel) table.getModel();
                int[] selectedRows = table.getSelectedRows();
                for (int rowIndex : selectedRows) {
                    Vector vector = (Vector) model.getDataVector().get(rowIndex);
                    if (vector.get(0) == null) {
                        throw new BaseException("ID\u4E0D\u80FD\u4E3A\u7A7A");
                    }
                    long id = Long.parseLong(vector.get(0).toString());
                    JarFile jarFile = DbUtils.findConfigById(id);
                    JarUtils.createJarFile(jarFile, isOverride);
                }
            }
            UIUtils.showInfo(this, "生成成功");
        } catch (BaseException | IOException ex) {
            UIUtils.showInfo(this, ex.getLocalizedMessage());
        }
    }

    private void save(ActionEvent l) {
        try {
            stopEdit(tblFiles);

            UIUtils.checkNameAndPath(txtFileName, txtFilePath);

            JarFile jarFile = UIUtils.buildJarFile(StrUtil.isEmpty(txtId.getText()) ? null : Long.parseLong(txtId.getText()), txtFileName.getText(), txtFilePath.getText(), (DefaultTableModel) tblFiles.getModel());
            DbUtils.saveJarFile(jarFile);

            UIUtils.loadData(this, jarFile);

            UIUtils.showInfo(this, "保存成功");
        } catch (BaseException ex) {
            UIUtils.showInfo(this, ex.getLocalizedMessage());
        }
    }

    private void delLine(ActionEvent l, JTable table) {
        int[] selectedRows = table.getSelectedRows();
        DefaultTableModel model = (DefaultTableModel) table.getModel();
        for (int selectedRow : selectedRows) {
            model.removeRow(selectedRow);
        }
    }

    private void addLine(ActionEvent e, JTable table) {
        DefaultTableModel model = (DefaultTableModel) table.getModel();
        model.addRow(new Object[]{});
    }

    private void stopEdit(JTable table) {
        for (int i = 0; i < table.getRowCount(); i++) {
            for (int j = 0; j < table.getColumnCount(); j++) {
                table.getCellEditor(i, j).stopCellEditing();
            }
        }
    }

    private void btnChooseDirMouseReleased(MouseEvent e) {
        JFileChooser fileChooser = new JFileChooser(DbUtils.getDefaultSavePath());
        fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        fileChooser.setMultiSelectionEnabled(false);
        fileChooser.showOpenDialog(this);
        File file = fileChooser.getSelectedFile();
        if (file != null) {
            if (file.exists() && file.isDirectory()) {
                txtFilePath.setText(file.getAbsolutePath());
            }
        }
    }

    private void tblFilesMouseReleased(MouseEvent e) {
        if (e.getButton() == MouseEvent.BUTTON3) {
            if (e.getSource() instanceof JScrollPane) {
                filesPopupMenu.show(tblFiles, e.getX(), e.getY() - tblFiles.getTableHeader().getHeight());
            } else {
                filesPopupMenu.show(tblFiles, e.getX(), e.getY());
            }
        }
    }

    private void tblJarsMouseReleased(MouseEvent e) {
        if (e.getButton() == MouseEvent.BUTTON3) {
            if (e.getSource() instanceof JScrollPane) {
                jarfilesPopupMenu.show(tblJars, e.getX(), e.getY() - tblJars.getTableHeader().getHeight());
            } else {
                jarfilesPopupMenu.show(tblJars, e.getX(), e.getY());
            }
        }
    }

    private void tblTaskMouseReleased(MouseEvent e) {
        if (e.getButton() == MouseEvent.BUTTON3) {
            if (e.getSource() instanceof JScrollPane) {
                taskPopupMenu.show(tblTask, e.getX(), e.getY() - tblTask.getTableHeader().getHeight());
            } else {
                taskPopupMenu.show(tblTask, e.getX(), e.getY());
            }
        }
    }

    private void tblTaskDetailMouseReleased(MouseEvent e) {
        // TODO add your code here
    }

    private void tblSettingsMouseReleased(MouseEvent e) {
        if (e.getButton() == MouseEvent.BUTTON3) {
            if (e.getSource() instanceof JScrollPane) {
                settingPopupMenu.show(tblSettings, e.getX(), e.getY() - tblSettings.getTableHeader().getHeight());
            } else {
                settingPopupMenu.show(tblSettings, e.getX(), e.getY());
            }
        }
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
		tabbedPane1 = new JTabbedPane();
		panel1 = new JPanel();
		label1 = new JLabel();
		txtFileName = new JTextField();
		label2 = new JLabel();
		txtFilePath = new JTextField();
		btnChooseDir = new JButton();
		scrollPane1 = new JScrollPane();
		tblFiles = new JTable();
		txtId = new JTextField();
		panel2 = new JPanel();
		scrollPane2 = new JScrollPane();
		tblJars = new JTable();
		panel3 = new JPanel();
		scrollPane3 = new JScrollPane();
		tblTask = new JTable();
		scrollPane6 = new JScrollPane();
		tblTaskDetail = new JTable();
		label3 = new JLabel();
		panel4 = new JPanel();
		scrollPane4 = new JScrollPane();
		tblSettings = new JTable();
		panel5 = new JPanel();
		scrollPane5 = new JScrollPane();
		logPane1 = new JTextPane();

		//======== this ========
		setMinimumSize(new Dimension(800, 600));
		setTitle("Jar Builder");
		setResizable(false);
		Container contentPane = getContentPane();
		contentPane.setLayout(null);

		//======== tabbedPane1 ========
		{

			//======== panel1 ========
			{
				panel1.setLayout(null);

				//---- label1 ----
				label1.setText("\u6587\u4ef6\u540d");
				panel1.add(label1);
				label1.setBounds(new Rectangle(new Point(10, 10), label1.getPreferredSize()));
				panel1.add(txtFileName);
				txtFileName.setBounds(50, 5, 270, txtFileName.getPreferredSize().height);

				//---- label2 ----
				label2.setText("\u6587\u4ef6\u8def\u5f84");
				panel1.add(label2);
				label2.setBounds(new Rectangle(new Point(350, 10), label2.getPreferredSize()));
				panel1.add(txtFilePath);
				txtFilePath.setBounds(400, 5, 340, txtFilePath.getPreferredSize().height);

				//---- btnChooseDir ----
				btnChooseDir.setIcon(UIManager.getIcon("Tree.openIcon"));
				btnChooseDir.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseReleased(MouseEvent e) {
						btnChooseDirMouseReleased(e);
					}
				});
				panel1.add(btnChooseDir);
				btnChooseDir.setBounds(new Rectangle(new Point(745, 5), btnChooseDir.getPreferredSize()));

				//======== scrollPane1 ========
				{
					scrollPane1.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblFilesMouseReleased(e);
						}
					});

					//---- tblFiles ----
					tblFiles.setModel(new DefaultTableModel(
						new Object[][] {
							{null, "", "", null},
						},
						new String[] {
							"ID", "\u6587\u4ef6\u8def\u5f84", "\u6620\u5c04\u8def\u5f84", "\u6392\u9664\u89c4\u5219"
						}
					) {
						Class<?>[] columnTypes = new Class<?>[] {
							Object.class, String.class, String.class, String.class
						};
						boolean[] columnEditable = new boolean[] {
							false, true, true, true
						};
						@Override
						public Class<?> getColumnClass(int columnIndex) {
							return columnTypes[columnIndex];
						}
						@Override
						public boolean isCellEditable(int rowIndex, int columnIndex) {
							return columnEditable[columnIndex];
						}
					});
					tblFiles.setShowHorizontalLines(true);
					tblFiles.setShowVerticalLines(true);
					tblFiles.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblFilesMouseReleased(e);
						}
					});
					scrollPane1.setViewportView(tblFiles);
				}
				panel1.add(scrollPane1);
				scrollPane1.setBounds(0, 35, 800, 505);

				//---- txtId ----
				txtId.setVisible(false);
				panel1.add(txtId);
				txtId.setBounds(new Rectangle(new Point(5, 0), txtId.getPreferredSize()));

				{ // compute preferred size
					Dimension preferredSize = new Dimension();
					for(int i = 0; i < panel1.getComponentCount(); i++) {
						Rectangle bounds = panel1.getComponent(i).getBounds();
						preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
						preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
					}
					Insets insets = panel1.getInsets();
					preferredSize.width += insets.right;
					preferredSize.height += insets.bottom;
					panel1.setMinimumSize(preferredSize);
					panel1.setPreferredSize(preferredSize);
				}
			}
			tabbedPane1.addTab("\u6587\u4ef6\u4fe1\u606f", panel1);

			//======== panel2 ========
			{
				panel2.setLayout(null);

				//======== scrollPane2 ========
				{
					scrollPane2.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblJarsMouseReleased(e);
						}
					});

					//---- tblJars ----
					tblJars.setModel(new DefaultTableModel(
						new Object[][] {
							{"", "", null, false},
						},
						new String[] {
							"ID", "\u6587\u4ef6\u540d", "\u6587\u4ef6\u8def\u5f84", "\u662f\u5426\u9ed8\u8ba4"
						}
					) {
						Class<?>[] columnTypes = new Class<?>[] {
							Object.class, String.class, String.class, Boolean.class
						};
						boolean[] columnEditable = new boolean[] {
							false, false, false, false
						};
						@Override
						public Class<?> getColumnClass(int columnIndex) {
							return columnTypes[columnIndex];
						}
						@Override
						public boolean isCellEditable(int rowIndex, int columnIndex) {
							return columnEditable[columnIndex];
						}
					});
					tblJars.setShowHorizontalLines(true);
					tblJars.setShowVerticalLines(true);
					tblJars.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblJarsMouseReleased(e);
						}
					});
					scrollPane2.setViewportView(tblJars);
				}
				panel2.add(scrollPane2);
				scrollPane2.setBounds(0, 0, 800, 540);

				{ // compute preferred size
					Dimension preferredSize = new Dimension();
					for(int i = 0; i < panel2.getComponentCount(); i++) {
						Rectangle bounds = panel2.getComponent(i).getBounds();
						preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
						preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
					}
					Insets insets = panel2.getInsets();
					preferredSize.width += insets.right;
					preferredSize.height += insets.bottom;
					panel2.setMinimumSize(preferredSize);
					panel2.setPreferredSize(preferredSize);
				}
			}
			tabbedPane1.addTab("\u6587\u4ef6\u5217\u8868", panel2);

			//======== panel3 ========
			{
				panel3.setLayout(null);

				//======== scrollPane3 ========
				{
					scrollPane3.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblTaskMouseReleased(e);
						}
					});

					//---- tblTask ----
					tblTask.setModel(new DefaultTableModel(
						new Object[][] {
							{null, null},
						},
						new String[] {
							"ID", "\u4efb\u52a1\u540d"
						}
					) {
						Class<?>[] columnTypes = new Class<?>[] {
							Object.class, String.class
						};
						boolean[] columnEditable = new boolean[] {
							false, true
						};
						@Override
						public Class<?> getColumnClass(int columnIndex) {
							return columnTypes[columnIndex];
						}
						@Override
						public boolean isCellEditable(int rowIndex, int columnIndex) {
							return columnEditable[columnIndex];
						}
					});
					tblTask.setShowHorizontalLines(true);
					tblTask.setShowVerticalLines(true);
					tblTask.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblTaskMouseReleased(e);
						}
					});
					scrollPane3.setViewportView(tblTask);
				}
				panel3.add(scrollPane3);
				scrollPane3.setBounds(0, 0, 800, 240);

				//======== scrollPane6 ========
				{
					scrollPane6.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblTaskDetailMouseReleased(e);
						}
					});

					//---- tblTaskDetail ----
					tblTaskDetail.setModel(new DefaultTableModel(
						new Object[][] {
							{null, null, null, null, null, null, null, null, null},
						},
						new String[] {
							"ID", "\u6587\u4ef6\u540d", "\u90e8\u7f72\u65b9\u5f0f", "\u5730\u5740", "\u7aef\u53e3", "\u8d26\u53f7", "\u5bc6\u7801", "EAS\u8def\u5f84", "\u90e8\u7f72\u8def\u5f84"
						}
					) {
						Class<?>[] columnTypes = new Class<?>[] {
							Object.class, String.class, String.class, String.class, Integer.class, String.class, String.class, String.class, String.class
						};
						boolean[] columnEditable = new boolean[] {
							false, true, true, true, true, true, true, true, true
						};
						@Override
						public Class<?> getColumnClass(int columnIndex) {
							return columnTypes[columnIndex];
						}
						@Override
						public boolean isCellEditable(int rowIndex, int columnIndex) {
							return columnEditable[columnIndex];
						}
					});
					tblTaskDetail.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblTaskDetailMouseReleased(e);
						}
					});
					scrollPane6.setViewportView(tblTaskDetail);
				}
				panel3.add(scrollPane6);
				scrollPane6.setBounds(0, 265, 800, 280);

				//---- label3 ----
				label3.setText("\u4efb\u52a1\u660e\u7ec6");
				panel3.add(label3);
				label3.setBounds(new Rectangle(new Point(0, 245), label3.getPreferredSize()));

				{ // compute preferred size
					Dimension preferredSize = new Dimension();
					for(int i = 0; i < panel3.getComponentCount(); i++) {
						Rectangle bounds = panel3.getComponent(i).getBounds();
						preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
						preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
					}
					Insets insets = panel3.getInsets();
					preferredSize.width += insets.right;
					preferredSize.height += insets.bottom;
					panel3.setMinimumSize(preferredSize);
					panel3.setPreferredSize(preferredSize);
				}
			}
			tabbedPane1.addTab("\u4efb\u52a1\u8ba1\u5212", panel3);

			//======== panel4 ========
			{
				panel4.setLayout(null);

				//======== scrollPane4 ========
				{
					scrollPane4.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblSettingsMouseReleased(e);
						}
					});

					//---- tblSettings ----
					tblSettings.setModel(new DefaultTableModel(
						new Object[][] {
							{null, null, null, null},
						},
						new String[] {
							"ID", "\u5c5e\u6027", "\u503c", "\u63cf\u8ff0"
						}
					) {
						Class<?>[] columnTypes = new Class<?>[] {
							Object.class, String.class, String.class, String.class
						};
						boolean[] columnEditable = new boolean[] {
							false, false, true, false
						};
						@Override
						public Class<?> getColumnClass(int columnIndex) {
							return columnTypes[columnIndex];
						}
						@Override
						public boolean isCellEditable(int rowIndex, int columnIndex) {
							return columnEditable[columnIndex];
						}
					});
					tblSettings.setShowHorizontalLines(true);
					tblSettings.setShowVerticalLines(true);
					tblSettings.addMouseListener(new MouseAdapter() {
						@Override
						public void mouseReleased(MouseEvent e) {
							tblSettingsMouseReleased(e);
						}
					});
					scrollPane4.setViewportView(tblSettings);
				}
				panel4.add(scrollPane4);
				scrollPane4.setBounds(0, 0, 800, 540);

				{ // compute preferred size
					Dimension preferredSize = new Dimension();
					for(int i = 0; i < panel4.getComponentCount(); i++) {
						Rectangle bounds = panel4.getComponent(i).getBounds();
						preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
						preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
					}
					Insets insets = panel4.getInsets();
					preferredSize.width += insets.right;
					preferredSize.height += insets.bottom;
					panel4.setMinimumSize(preferredSize);
					panel4.setPreferredSize(preferredSize);
				}
			}
			tabbedPane1.addTab("\u8bbe\u7f6e", panel4);

			//======== panel5 ========
			{
				panel5.setLayout(null);

				//======== scrollPane5 ========
				{

					//---- logPane1 ----
					logPane1.setEditable(false);
					scrollPane5.setViewportView(logPane1);
				}
				panel5.add(scrollPane5);
				scrollPane5.setBounds(0, 0, 800, 535);

				{ // compute preferred size
					Dimension preferredSize = new Dimension();
					for(int i = 0; i < panel5.getComponentCount(); i++) {
						Rectangle bounds = panel5.getComponent(i).getBounds();
						preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
						preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
					}
					Insets insets = panel5.getInsets();
					preferredSize.width += insets.right;
					preferredSize.height += insets.bottom;
					panel5.setMinimumSize(preferredSize);
					panel5.setPreferredSize(preferredSize);
				}
			}
			tabbedPane1.addTab("\u65e5\u5fd7", panel5);
		}
		contentPane.add(tabbedPane1);
		tabbedPane1.setBounds(0, 0, 800, 565);

		{ // compute preferred size
			Dimension preferredSize = new Dimension();
			for(int i = 0; i < contentPane.getComponentCount(); i++) {
				Rectangle bounds = contentPane.getComponent(i).getBounds();
				preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
				preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
			}
			Insets insets = contentPane.getInsets();
			preferredSize.width += insets.right;
			preferredSize.height += insets.bottom;
			contentPane.setMinimumSize(preferredSize);
			contentPane.setPreferredSize(preferredSize);
		}
		pack();
		setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
	private JTabbedPane tabbedPane1;
	private JPanel panel1;
	private JLabel label1;
	private JTextField txtFileName;
	private JLabel label2;
	private JTextField txtFilePath;
	private JButton btnChooseDir;
	private JScrollPane scrollPane1;
	private JTable tblFiles;
	private JTextField txtId;
	private JPanel panel2;
	private JScrollPane scrollPane2;
	private JTable tblJars;
	private JPanel panel3;
	private JScrollPane scrollPane3;
	private JTable tblTask;
	private JScrollPane scrollPane6;
	private JTable tblTaskDetail;
	private JLabel label3;
	private JPanel panel4;
	private JScrollPane scrollPane4;
	private JTable tblSettings;
	private JPanel panel5;
	private JScrollPane scrollPane5;
	private JTextPane logPane1;
    // JFormDesigner - End of variables declaration  //GEN-END:variables
}
